<template>
	<view>
		<uv-popup ref="popup" round="12" :safeAreaInsetBottom="false" closeOnClickOverlay mode="center">
			<view class="view">
				<view class="display-flex flex-direction-column center align-items" style="padding: 34rpx 24rpx;">
					<view class="display-flex center align-items">
						<image :src="config.logo" style="width: 80rpx;height: 80rpx;" class="border-radius" mode="">
						</image>
						<image :src="imgaeUrl('/static/home/lj.png')" style="width: 60rpx;height: 40rpx;margin: 0 50rpx;" mode=""></image>
						<image :src="imgaeUrl('/static/home/logo.png')" style="width: 90rpx;height: 90rpx;" class="border-radius" mode="">
						</image>
					</view>
					<view class="font-size-30 font-weight-500 margin-top-40" style="color: #1a1a1a;font-weight: bold;">
						您还未授权成为推客
					</view>
					<view class="font-size-26 color-666 margin-top-20" style="color: #808080;">
						分享直播间/直播间购物无收益
					</view>
					<view @click="navigateTo" class="button color-FFF font-size-28 font-weight-500 margin-top-60">
						去授权拿收益
					</view>
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script>
	import local from '@/utils/localStorage.js'; //引入本地存储方法
	import * as api from '@/request/app.js'; // 引入api 方法
	import {
		imgaeUrl,
	} from '@/utils/index.js';
	export default {
		name: "a-customAuth",
		props: {
			type: {
				type: Number,
				default: 0
			},
		},
		data() {
			return {
				config: {},
				imgaeUrl,
			};
		},
		created() {
			this.config = local.get('config')
		},
		methods: {
			open() {
				this.$refs.popup.open();
			},
			close() {
				this.$refs.popup.close();
			},
			navigateTo() {
				this.addPushUser()
			},
			async addPushUser() {
				uni.showLoading({
					title: '加载中',
				});
				const {
					code,
					data
				} = await api.addPushUser()
				if (code == 0) {
					uni.hideLoading();
					wx.openBusinessView({
						businessType: data.bind_business_type,
						queryString: data.bind_query_string,
						extraData: {
							commissionType: data.commissionType,
							commissionRatio: data.commissionRatio,
							headSupplierAppid: data.headSupplierAppid,
						}
					})
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.button {
		padding: 20rpx 106rpx;
		background: #FF7E00;
		border-radius: 50rpx;
	}

	.view {
		width: 582rpx;
		background: #FFFFFF;
	}
</style>